<!doctype html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
    <title>用户登录_{:confv('title')}</title>
    <meta name="keywords" content="{:confv('keywords')}">
    <meta name="description" content="{:confv('description')}">
    {load href="__static__/common/css/common_login.css" /}
    {load href="__static__/xzyn/css/xzyn.css" /}
    {load href="__static__/xzyn/css/xzyn_icon.min.css" /}
    {load href="__static__/common/bootstrap/css/bootstrap.min.css" /}
</head>

<body>
    <div class="cont">
        <div class="demo">
            <div class="login">
                <div class="login__check">
                	<img src="{$user_qqinfo['figureurl_qq_2']}" alt="">
                    <p>
                    	<h2  style="color:#fff;">{$user_qqinfo[nickname]}</h2>
                    	<p class="login_gzc" style="color:#F1F1F1;">新用户请输入用户名和密码绑定当前QQ帐号<br />
                    		老用户请输入用户名和密码即可绑定当前QQ帐号
                    	</p>
                    </p>
                </div>
                <form action="{:url('login/loginadd')}" method="POST" class="login__form">
                    <div class="login__row">
                        <svg class="login__icon name svg-icon" viewBox="0 0 20 20">
                            <path d="M0,20 a10,8 0 0,1 20,0z M10,0 a4,4 0 0,1 0,8 a4,4 0 0,1 0,-8" />
                        </svg>
                        <input type="text" name="username" value="" class="login__input name" placeholder="用户名" />
                    </div>
                    <div class="login__row">
                        <svg class="login__icon pass svg-icon" viewBox="0 0 20 20">
                            <path d="M0,20 20,20 20,8 0,8z M10,13 10,16z M4,8 a6,8 0 0,1 12,0" />
                        </svg>
                        <input type="password" name="password" value="" class="login__input pass" placeholder="密码" />
                    </div>
                    <button class="login__submit">绑定登录</button>
                    <p class="login__signup">


                    </p>
                </form>
            </div>

        </div>
    </div>
    {load href="__static__/common/jquery/jquery-2.2.3.min.js" /}
    {load href="__static__/common/js/common_login.js" /}
    {load href="__static__/xzyn/js/xzyn.js" /}
    <script>
        $(document).ready(function() {
            var animating = false,
                submitPhase1 = 1100,
                submitPhase2 = 400,
                logoutPhase1 = 800,
                $login = $('.login'),
                $app = $('.app');

            function ripple(elem, e) {
                $('.ripple').remove();
                var elTop = elem.offset().top,
                    elLeft = elem.offset().left,
                    x = e.pageX - elLeft,
                    y = e.pageY - elTop;
                var $ripple = $('<div class=\'ripple\'></div>');
                $ripple.css({
                    top: y,
                    left: x
                });
                elem.append($ripple);
            };
            $('.login__form').on('submit', function(e) {
                if(animating)
                    return false;
                var that = $(".login__submit");
                ripple($(that), e);
                var username = $('input[name^="username"]').val();
                var pas = $('input[name^="password"]').val();
                if( username == '' ){xzyn.msg('请填写用户名','e'); return false;}
                if( pas == '' ){xzyn.msg('请填写密码','e'); return false;}
                animating = true;
                $(that).addClass('processing');
                setTimeout(function() {
                    animating = false;
	                $.ajax({
	                    url: "{:url('login/qq_login')}", //请求url
	                    type: "post",  //请求的类型
	                    dataType: "json",  //数据类型
	                    data: {'password':pas,'username':username}, //发送到服务器的数据
	                    success:function(data) { //成功后执行
	                        console.log(data);
	                        if( data.status == 1 ){
	                        	xzyn.msg(data.info,'s',function(){
	                        		window.location.assign(data.url);
	                        	});
								$('input').val('');
	                        }else{
	                        	xzyn.msg(data.info,'e');
	                        }
	                        that.removeClass('processing');
	                    },
	                    error:function(data) { //失败后执行
	                        console.log(data);
	                        that.removeClass('processing');
	                    }
	                });
                }, submitPhase1);
                return false;
            });

        });
    </script>
</body>

</html>